C# to Java: What is a [DefaultProperty("value")]?

Posted by Shiftbit on Stack Overflow See other posts from Stack Overflow or by Shiftbit
Published on 2010-04-16T01:21:25Z Indexed on 2010/04/16 1:43 UTC
Read the original article Hit count: 257

Filed under:
|

I do not understand how the DefaultProperty Metadata tag work or what it signifies. I've read the MSDN and went through the sample but I find it confusing.

DefaultPropertyAttribute Class

I've read a few blogs and they seem to refer to the indexers. I'm not sure why you would want metadata for your properties? I am coming from a Java background, perhaps a Java analogy would help.

[DefaultProperty("Value")]
    public abstract class FOO<T> : ANY, IBAR<T>
    {
        public FOO() { }
        public FOO(T value) { this.Value = value; }
        public virtual T Value { get; set; }
    }

Follow up: Property Grid

© Stack Overflow or respective owner

Related posts about c#

Related posts about metadata